//验证是否为验证回文串
/*
    输入: "A man, a plan, a canal: Panama" 1
    输出: true
*/

const isPalindrome =(s)=>{
    let reg = /[^A-Za-z0-9]/g
    const arr = s.toLowerCase().replace(reg,'').split('')
    let i =0;
    let j = arr.length -1;
    while(i<j){
        if(arr[i]===arr[j]){
            i+=1
            j-=1
        }else{
            return false
        }
    }

    return true
}

const isPalindrome1 =(s)=>{
    let reg = /[^A-Za-z0-9]/g
    const startStr = s.toLowerCase().replace(reg,'')
    const endStr = startStr.split('').reverse().join('')

    return startStr === endStr
}